<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>组件参数校验</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
	<div id="app">
		<child :content=""></child>
	</div>
	<script>

		Vue.component("child",{
			props: {
				content: {
					type: String,	//属性
					required: true,	//是否必须
					default: "xuchun",	//默认值
					validator: function(value) {	//校验器
						return (value.length > 5)
					}
				}
			},
			template: "<div>{{content}}</div>"
		})

		new Vue({
			el: "#app",
			data: {
				
			},
			methods: {
				
			}
		})
	</script>
</body>
</html>